package com.lvy.hczn.front.business.controller;

import com.lvy.hczn.front.business.dto.Param;
import com.lvy.hczn.front.business.service.ProductionProcessingService;
import com.lvy.hczn.front.business.util.ResultUtil;
import com.lvy.hczn.front.common.exception.UtilException;
import com.lvy.hczn.front.system.domain.business.ProductionProcessing;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description:
 * @projectName: wms-center
 * @package: com.service.system.center.controller.web
 * @className: ProductionProcessingController
 * @author: yw
 * @date: 2025/7/1 20:02
 */
@RequestMapping("/wcs/production/processing")
@RestController
@Slf4j
public class ProductionProcessingController {

    @Autowired
    private ProductionProcessingService productionProcessingService;

    @ApiOperation(value = "生产加工新原料箱", notes = "生产加工后放入的新货箱的商品列表")
    @PostMapping("/selectProcessingEntryListByBoxCode")
    @Deprecated
    public ResultUtil<List<ProductionProcessing>> selectProcessingEntryList(@RequestBody Param param) {
        try {
            List<ProductionProcessing> list = productionProcessingService.selectProcessingEntryListByBoxCode(param);
            return ResultUtil.ok(list);
        } catch (Exception e) {
            log.error("selectProcessingEntryListByBoxCode异常:", e);
            if (e instanceof UtilException) {
                return ResultUtil.failed(e.getMessage());
            } else {
                return ResultUtil.failed("系统异常");
            }
        }
    }
}
